package project.parser.ast.exps.op.binary;

import project.parser.ast.exps.Exp;

import static project.parser.tokenizer.TokenType.CLOSED_PAR;
import static project.parser.tokenizer.TokenType.OPEN_PAR;

public abstract class BinaryOp implements Exp {
	protected final Exp left;
	protected final Exp right;

	public BinaryOp(Exp left, Exp right) {
		this.left = left;
		this.right = right;
	}

	abstract protected String opToString();

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder().append(OPEN_PAR).append(left)
				.append(opToString()).append(right).append(CLOSED_PAR);
		return sb.toString();
	}
}
